package org.example.back.service.plan;

import org.example.back.entity.plan.BodybuildingPlan;
import org.example.back.mapper.plan.BodybuildingPlanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;

@Service
public class BodybuildingPlanService {

    @Autowired
    private BodybuildingPlanMapper bodybuildingPlanMapper;

    public boolean addPlan(BodybuildingPlan plan) {
        return bodybuildingPlanMapper.insertPlan(plan) > 0;
    }

    public BodybuildingPlan getPlanByUserIdAndStartDate(Integer userId, LocalDate startDate) {
        return bodybuildingPlanMapper.selectByUserIdAndStartDate(userId, startDate);
    }
}
